<?php
#设置锦鲤
ini_set('display_errors', 1);
error_reporting(-1);
require_once '/data/wwwroot/g_vendor/autoload.php';


$uid = $argv[1] ?? null;

if(empty($uid)){
    echo "请输入锦鲤UID！".PHP_EOL;
    exit;
}

if(\Biz\service\springHomeDecActivity\ActivityService::running()){
    echo "请在活动结束后设置锦鲤！".PHP_EOL;
    exit;
}

if(!\Biz\service\springHomeDecActivity\WishService::hasWish($uid)){
    echo "UID未参加活动，不能设置为锦鲤！".PHP_EOL;
    exit;
}

if(!\Biz\service\springHomeDecActivity\LuckyCharmTicketService::userTicketsCount($uid)){
    echo "UID没有锦鲤券，请先发放锦鲤券！".PHP_EOL;
    exit;
}

$nRet = \Biz\service\springHomeDecActivity\LuckyCharmService::setLuckCharm($uid);

if(!$nRet){
    echo "锦鲤设置失败".PHP_EOL;
    exit;
}

echo "锦鲤设置成功".PHP_EOL;
exit;

